/**
 * 六边形地图，从最上走到最下的最大权值
 *       X
 *      X X
 *     X X X
 *    X X X X
 *   X X X X X
 *    X X X X
 *   X X X X X
 *    X X X X
 *   X X X X X
 *    X X X X
 *   X X X X X
 *    X X X X
 *   X X X X X
 *    X X X X
 *     X X X
 *      X X 
 *       X
 * 
 * 分为三段输入
 * i = [1...N]，有i个
 * i = [N+1...3N-2]，每两行有N-1和N个
 * i = [3N-1...4N-3]，每行有 4N-2-i 个，即从N-1到1
 * 每个格子一般有三个来路，注意处理，边界情况
 * 注意处理第3N-1行 
 */
#include <bits/stdc++.h>
using namespace std;

using llt = long long;

int N;
vector<vector<llt>> A;
vector<vector<llt>> D;

vector<pair<int, int>> get(int r, int c){
    if(r <= N){
        if(r == 2) return {{1, 1}};
        if(c == 1) return {{r - 1, 1}};
        if(c == r) return {{r - 1, c - 1}};        
        return {{r - 1, c - 1}, {r - 1, c}, {r - 2, c - 1}};
    }
    if(r <= 3 * N - 2){
        if(r - N & 1){ // N-1个
            return {{r - 1, c}, {r - 1, c + 1}, {r - 2, c}};
        }else{
            if(c == 1) return {{r - 1, 1}, {r - 2, 1}};
            if(c == N) return {{r - 1, N - 1}, {r - 2, N}};
            return {{r - 1, c - 1}, {r - 1, c}, {r - 2, c}};           
        }
    }
    if(r == 3 * N - 1) return {{r - 1, c}, {r - 1, c + 1}, {r - 2, c}};
    return {{r - 1, c}, {r - 1, c + 1}, {r - 2, c + 1}};
}

llt calc(int r, int c){
    auto vec = get(r, c);
    llt tmp = -1;
    for(const auto & p : vec){
        if(-1 == tmp or tmp < D[p.first][p.second]) tmp = D[p.first][p.second];
    }
    return A[r][c] + tmp;
}

llt proc(){
    int n = 4 * N - 3;
    D.assign(n + 1, vector<llt>(N + 1, 0LL));

    D[1][1] = A[1][1];
    for(int i=2;i<=N;++i)for(int j=1;j<=i;++j) D[i][j] = calc(i, j);
    for(int i=N+1;i<=3*N-2;i+=2){
        for(int j=1;j<=N-1;++j) D[i][j] = calc(i, j);
        for(int j=1;j<=N;++j) D[i + 1][j] = calc(i + 1, j);
    }
    for(int i=3*N-1,k=N-1;i<=4*N-3;++i,--k)for(int j=1;j<=k;++j)D[i][j] = calc(i, j);
    return D[4*N-3][1];
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
    cin >> N;
    A.assign(4*N-1, vector<llt>(N + 1, 0));
    for(int i=1;i<=N;++i)for(int j=1;j<=i;++j)cin>>A[i][j];
    for(int i=N+1;i<=3*N-2;i+=2){
        for(int j=1;j<=N-1;++j) cin >> A[i][j];
        for(int j=1;j<=N;++j) cin >> A[i + 1][j];
    }
    for(int i=3*N-1,k=N-1;i<=4*N-3;++i,--k)for(int j=1;j<=k;++j)cin>>A[i][j];
    cout << proc() << endl;
    return 0;
}